import {
  request
} from '../utils/request';

// 协会相关列表
const societyList = () => {
  return request({
    url: '/society/list'
  });
}

// 协会相关详情
const societyDetails = (societyId) => {
  return request({
    url: `/society/${societyId}`
  });
}

// 新闻列表
const newsList = (pageNum, pageSize) => {
  return request({
    url: '/news/list',
    data: {
      pageNum: pageNum,
      pageSize: pageSize
    }
  });
}

// 新闻详情
const newsDetails = (newsId) => {
  return request({
    url: `/news/${newsId}`
  });
}

// 点赞新闻
const likeNews = (newsId) => {
  return request({
    url: `/news/like/${newsId}`
  });
}

// 收藏新闻
const collectNews = (newsId) => {
  return request({
    url: `/news/collect/${newsId}`
  });
}

// 收藏新闻列表
const collectNewsDetails = (newsId) => {
  return request({
    url: `/news/${newsId}`
  });
}

// 轮播图
const swiperList = () => {
  return request({
    url: '/banner/list'
  });
}
// 培训视频首页中的tab多选
const trainingVideoIndex = () => {
    return request({
      url: '/kbProject/list'
    });
}
// 合作视频页中的tab多选
const HzVideoIndex = () => {
    return request({
      url: '/KbHzProject/list'
    });
}
//首页 和 更多培训视频中的banner
const trainingbanner= (e) => {
    return request({
      url: `/banner/list?location=${e}`
    });
}
// 培训视频首页=》 行业资料库
const kbDocList = (data) => {
    return request({
      url: '/kbDoc/list',
      data: {...data,  isAsc:'desc'}
    });
}
// 培训视频首页=》 更多视频
const kbVideoList = (data) => {
    return request({
      url: '/kbVideo/list',
      data: {...data,  isAsc:'desc'}
    });
}
//视频详情
const kbVideoDetail = (id) => {
    return request({
      url: `/kbVideo/${id}`
    });
}
//视频收藏与否
const toggleCollectV = ({videoId,ifCollect}) => {
    return request({
      url: '/kbVideo/toggleCollect',
      method: 'POST',
      data: {
        videoId,
        ifCollect
      }
    });
}
//文章详情
const kbDocDetail = (id) => {
    return request({
      url: `/kbDoc/${id}`
    });
}
//文章收藏与否
const toggleCollectZ = ({docId,ifCollect}) => {
    return request({
      url: '/kbDoc/toggleCollect',
      method: 'POST',
      data: {
        docId,
        ifCollect
      }
    });
}
// 我收藏的培训视频
const kbVideoCollectList = ({pageNum,pageSize,type}) => {
    return request({
      url: '/kbVideo/collect/list',
      data: {
        pageNum: pageNum,
        pageSize: pageSize,
        type
      }
    });
}
// 我收藏的培训资料
const kbDocCollectList = ({pageNum,pageSize}) => {
    return request({
      url: '/kbDoc/collect/list',
      data: {
        pageNum: pageNum,
        pageSize: pageSize,
      }
    });
}
module.exports = {
  societyList,
  societyDetails,
  newsList,
  newsDetails,
  likeNews,
  collectNews,
  collectNewsDetails,
  swiperList,
  trainingVideoIndex,
  kbDocList,
  kbVideoList,
  trainingbanner,
  kbVideoDetail,
  toggleCollectV,
  kbDocDetail,
  toggleCollectZ,
  kbVideoCollectList,
  kbDocCollectList,
  HzVideoIndex
}